﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;

namespace YouHP.Pages.Group
{
    public class GroupBasePage : YouHP.Pages.BasePage
    {
        protected GroupInfo GroupData;
        protected GroupUserInfo GroupUserData;
        
        protected int gid;
        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();
            if (ErrorCount > 0) return;

            
        }

        protected void HandleCommon()
        {
            gid = RequestTools.GetInt("gid", 0);
            if (gid <= 0)
            {
                this.AddErrLine("找不到圈子");
                return;
            }
            GroupData = GroupBLL.Instance.GetGroupInfo(gid);
            if (GroupData.Id <= 0)
            {
                this.AddErrLine("找不到圈子");
                return;
            }
            if (GroupData.IsValid == 0)
            {
                this.AddErrLine("该圈子已被删除");
     
                return;
            }
            GroupUserData = GroupUserBLL.Instance.GetGroupUserInfo(gid, UserData.Id);
            
        }
    }
}